<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8" />
    <title>统一地图平台</title><link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
    <style>
        html,
        body,
        #mapui {
            width: 100%;
            height: 100%;
        }

        html,
        body {
            margin: 0;
            padding: 0;
        }
    </style>
</head>

<body>
    <div id="mapui"></div>
    <button type="button" onclick="add()" style="position: absolute;top: 10px;right: 10px;">添加</button>
    <button type="button" onclick="remove()" style="position: absolute;top: 40px;right: 10px;">删除</button>

    <script src="./js_example/script/map.min.js"></script>
    <script src="./js_example/script/demo.js"></script>

    <script>
        

        var amap = null;
        var marker = null;
        var markerManage = null;
        map.Factory.create('mapui', {
            style: style,
            center: center,
            // center: [12500000, 2720000],
            zoom: 11,
            strategy: ['mapboxgl', 'openlayers', 'leaflet'],
            fullExtent: {
                xmin: 108.23365,
                ymin: 17.95253,
                xmax: 111.78395,
                ymax: 20.13104
            }
        }, (o) => {
            amap = o;
        });

        function add() {
            markerManage = map.Factory.MarkerManage();
            var geojson = {
                "type": "FeatureCollection",
                "features": [{
                    "type": "Feature",
                    "geometry": {
                        "type": "Point",
                        "coordinates": [110.32343, 19.99401]
                    },
                }, {
                    "type": "Feature",
                    "geometry": {
                        "type": "Point",
                        "coordinates": [110.33919, 19.99768]
                    },
                }]
            };

            geojson.features.forEach(function(item) {
                marker = markerManage.add('1', item.geometry.coordinates);
            });
        }

        function remove() {
            markerManage.removeAll();
        }
    </script>
</body>

</html>